<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Uri Class - Fuel Documentation</title>
	<link href="../assets/css/main.css" media="screen" rel="stylesheet" />
	<script type="text/javascript" src="../assets/js/jquery-1.4.4.min.js"></script>
	<script type="text/javascript" src="../assets/js/nav.js"></script>
	<script type="text/javascript" src="../assets/js/highlight.pack.js"></script>
	<script type="text/javascript">
		$(function() {
			show_nav('classes', '../');
		});
		hljs.tabReplace = '    ';
		hljs.initHighlightingOnLoad();
	</script>
</head>
<body>

	<header>
		<h1>FUEL Documentation</h1>
	</header>

	<div id="main-nav"></div>

	<section id="content">
		<h2>Uri Class</h2>

		<p>The Uri class allows you to interact with the URI.</p>

		<article>
			<h4>create($uri = null, $variables = array(), $get_variables = array())</h4>
			<p>The <strong>create</strong> method allows you to create a URL with the given URI, including the base URL.</p>
			<table class="method">
				<tbody>
				<tr>
					<th class="legend">Static</th>
					<td>Yes</td>
				</tr>
				<tr>
					<th>Parameters</th>
					<td>
						<table class="parameters">
							<tr>
								<th>Param</th>
								<th>Default</th>
								<th class="description">Description</th>
							</tr>
							<tr>
								<th><kbd>$uri</kbd></th>
								<td><pre class="php"><code>null</code></pre></td>
								<td>The URL.</td>
							</tr>
							<tr>
								<th><kbd>$variables</kbd></th>
								<td><pre class="php"><code>array()</code></pre></td>
								<td>The variables for the URL.</td>
							</tr>
							<tr>
								<th><kbd>$get_variables</kbd></th>
								<td><pre class="php"><code>array()</code></pre></td>
								<td>The query string additions to the URL, its values &amp; keys can use variables from
									the $variables array.</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<th>Returns</th>
					<td>string</td>
				</tr>
				<tr>
					<th>Example</th>
					<td>
						<pre class="php"><code>echo Uri::create('controller/method');
// returns http://localhost/controller/method

echo Uri::create('controller/:some', array('some' => 'thing', 'and' => 'more'), array('what' => ':and'));
// returns http://localhost/controller/thing?what=more</code></pre>
					</td>
				</tr>
				</tbody>
			</table>
		</article>

		<article>
			<h4>current()</h4>
			<p>The <strong>current</strong> method allows you to fetch the current URL, including the base URL inside HMVC pattern.</p>
			<table class="method">
				<tbody>
				<tr>
					<th class="legend">Static</th>
					<td>Yes</td>
				</tr>
				<tr>
					<th>Parameters</th>
					<td>None</td>
				</tr>
				<tr>
					<th>Returns</th>
					<td>string</td>
				</tr>
				<tr>
					<th>Example</th>
					<td>
						<pre class="php"><code>// Example URL: http://localhost/module/controller/method
echo Uri::current(); // returns http://localhost/module/controller/method</code></pre>
					</td>
				</tr>
				</tbody>
			</table>
		</article>

		<article>
			<h4>detect()</h4>
			<p>The <strong>detect</strong> method detects the current URI to build the correct string.</p>
			<table class="method">
				<tbody>
				<tr>
					<th class="legend">Static</th>
					<td>Yes</td>
				</tr>
				<tr>
					<th>Parameters</th>
					<td>None</td>
				</tr>
				<tr>
					<th>Returns</th>
					<td>string</td>
				</tr>
				<tr>
					<th>Example</th>
					<td>
						<pre class="php"><code>// Example URL: http://localhost/controller/method
echo Uri::detect(); // returns controller/method</code></pre>
					</td>
				</tr>
				</tbody>
			</table>
		</article>

		<article>
			<h4>main()</h4>
			<p>The <strong>main</strong> method allows you to fetch the current URL, including the base URL.</p>
			<table class="method">
				<tbody>
				<tr>
					<th class="legend">Static</th>
					<td>Yes</td>
				</tr>
				<tr>
					<th>Parameters</th>
					<td>None</td>
				</tr>
				<tr>
					<th>Returns</th>
					<td>string</td>
				</tr>
				<tr>
					<th>Example</th>
					<td>
						<pre class="php"><code>// Example URL: http://localhost/controller/method
echo Uri::main(); // returns http://localhost/controller/method</code></pre>
					</td>
				</tr>
				</tbody>
			</table>
		</article>

		<article>
			<h4>segment($segment, $default = null)</h4>
			<p>The <strong>segment</strong> method allows you to return the desired segment, or false if it does not exist.</p>
			<table class="method">
				<tbody>
				<tr>
					<th class="legend">Static</th>
					<td>Yes</td>
				</tr>
				<tr>
					<th>Parameters</th>
					<td>
						<table class="parameters">
							<tr>
								<th>Param</th>
								<th>Default</th>
								<th class="description">Description</th>
							</tr>
							<tr>
								<th><kbd>$segment</kbd></th>
								<td><i>Required</i></td>
								<td>The segment number.</td>
							</tr>
							<tr>
								<th><kbd>$default</kbd></th>
								<td><pre class="php"><code>null</code></pre></td>
								<td>The default?</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<th>Returns</th>
					<td>string</td>
				</tr>
				<tr>
					<th>Example</th>
					<td>
						<pre class="php"><code>// Example URL: http://localhost/controller/method/param1/param2
echo Uri::segment(3); // returns param1</code></pre>
					</td>
				</tr>
				</tbody>
			</table>
		</article>

		<article>
			<h4>segments()</h4>
			<p>The <strong>segments</strong> method allows you to fetch the current URI segments in an array.</p>
			<table class="method">
				<tbody>
				<tr>
					<th class="legend">Static</th>
					<td>Yes</td>
				</tr>
				<tr>
					<th>Parameters</th>
					<td>None</td>
				</tr>
				<tr>
					<th>Returns</th>
					<td>array</td>
				</tr>
				<tr>
					<th>Example</th>
					<td>
						<pre class="php"><code>// Example URL: http://localhost/controller/method
echo Uri::segments(); // returns array(0 => 'controller', 1 => 'method')</code></pre>
					</td>
				</tr>
				</tbody>
			</table>
		</article>

		<article>
			<h4>string()</h4>
			<p>The <strong>string</strong> method allows you to fetch the current URI.</p>
			<table class="method">
				<tbody>
				<tr>
					<th class="legend">Static</th>
					<td>Yes</td>
				</tr>
				<tr>
					<th>Parameters</th>
					<td>None</td>
				</tr>
				<tr>
					<th>Returns</th>
					<td>string</td>
				</tr>
				<tr>
					<th>Example</th>
					<td>
						<pre class="php"><code>// Example URL: http://localhost/controller/method
echo Uri::string(); // returns controller/method</code></pre>
					</td>
				</tr>
				</tbody>
			</table>
		</article>

	</section>

	<section id="footer">
		<p>
			<a href="http://fuelphp.com">Fuel PHP</a> is released under the MIT license.<br />
			&copy; 2010 - 2011 Fuel Development Team
		</p>
	</section>

</body>
</html>